<template> 
<view class="popup_content">
            <view class="popup_textarea_item">
                <input class="popup_textarea" type="number" placeholder='请设置阈值' v-model="feedbackContent" @input="changeValue"/>
                <view @tap="submitFeedback('/pages/tabbar/tabbar-5/tabbar-5')">
                    <button class="popup_button">确认修改</button>
                </view>
            </view>
</view>

</template>

<script>
	import cityJson from '@/data/cityData.json'
	import graceChecker from '@/common/graceChecker.js'
	import datejs from 'dayjs'
	import utils from '@/utils/requset.js'
	import operate from '@/common/operate.js'
	export default{
    data() {
		return {
			userFeedbackHidden: false,  
			feedbackContent:getApp().globalData.userInfo.callLimitNum,
			preFormData: {
				id:getApp().globalData.userInfo.id,
				callLimitNum:6,
			},
			 
		}
	},
	onShow() {
		
	},
    methods: {
		changeValue(e){
			this.preFormData.callLimitNum = e.detail.value
		},
		cancelAdd(){
			this.areaShow = false
		},
		confirmAdd(){
			this.areaShow = false
				
		},
		showDiv() { // 显示输入弹出框
			this.userFeedbackHidden = false;
		},
		hideDiv() { // 隐藏输入弹出框
			this.userFeedbackHidden = true;
		},
		submitFeedback(url) { // 提交反馈
				var data = this.preFormData
				//todo 调用接口传递数据
				var header = {},
					url = "/purchase/preUser/update", 
					method = "POST";
				if (method) {
					method = method.toUpperCase(); 
					if (method == "POST") {
						header = {
						   'Content-Type': "application/json"
						};
					} else {
						header = {
							'Content-Type': "application/json"
						};
					}
				}
							 
				 uni.request({
					url: operate.api + url,		
					data: data,
					method: method,
					header: header,
					success: (res) => {
						if(res.statusCode && res.statusCode ==200){
							getApp().globalData.userInfo = res.data.data;
							uni.reLaunch({
								url: '/pages/tabbar/tabbar-5/tabbar-5'
							})
						}else{
							console.log("数据状态码！=200")
						}
						
					}
				})
				
				
				
				uni.switchTab({
					url
				})
		},
		
		
		
		
		
		
		
			
	}
}
</script>

<style>
	.popup_overlay {
        position: fixed;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: black;
        z-index: 1001;
        -moz-opacity: 0.8;
        opacity: .80;
        filter: alpha(opacity=88);
    }
    .popup_content {
        position: fixed;
        top: 50%;
        left: 50%;
        width: 520upx;
        height: 550upx;
        margin-left: -270upx;
        margin-top: -270upx;
        background-color: white;
        z-index: 1002;
        overflow: auto;
        border-radius: 500upx;
    }
    .popup_title {
        padding-top: 20upx;
		margin-bottom: 10upx;
        width: 480upx;
        text-align: center;
        font-size: 32upx;
    }
    .popup_textarea_item {
        padding-top: 5upx;
        height: 140upx;
        width: 440upx;
        background-color: #F1F1F1;
        margin:auto
    }
    .popup_textarea  { 
		height: 120upx;
        width: auto;
        font-size: 32upx;
        margin: auto;
		text-align: center;
 
		border: #4399FC;
    }
    .popup_button {
        color: white;
        background-color: #4399FC;
        border-radius: 20upx;
		margin-top: 100px;
    }
</style>
